package com.jg.tool.actable.db.po;

import com.jg.tool.actable.annotation.Index;
import com.jg.tool.actable.enums.IndexType;

/**
 * 索引结构
 */
public class IndexStructure {

    private String indexName;
    private String columnName;
    private boolean unique;

    public static IndexStructure buildFromIndex(Index index) {
        IndexStructure indexStructure = new IndexStructure();
        indexStructure.setIndexName(index.name());
        indexStructure.setColumnName(index.column());
        indexStructure.setUnique(index.type() == IndexType.UNIQUE);
        return indexStructure;
    }

    public String getIndexName() {
        return indexName;
    }

    public void setIndexName(String indexName) {
        this.indexName = indexName;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public boolean isUnique() {
        return unique;
    }

    public void setUnique(boolean unique) {
        this.unique = unique;
    }

}
